<!DOCTYPE html>
<html>
{% load static %}
<head>
<meta charset="utf-8"/>
<title>后台管理系统</title>
<meta name="author" content="DeathGhost" />
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/index.css' %}">
<!--[if lt IE 9]>
<script src="{% static 'admin/js/html5.js' %}"></script>
<![endif]-->
<script src="{% static 'admin/js/jquery.js' %}"></script>
<script src="{% static 'admin/js/jquery.mCustomScrollbar.concat.min.js' %}"></script>
<script>

	(function($){
		$(window).load(function(){

			$("a[rel='load-content']").click(function(e){
				e.preventDefault();
				var url=$(this).attr("href");
				$.get(url,function(data){
					$(".content .mCSB_container").append(data); //load new content inside .mCSB_container
					//scroll-to appended content
					$(".content").mCustomScrollbar("scrollTo","h2:last");
				});
			});

			$(".content").delegate("a[href='top']","click",function(e){
				e.preventDefault();
				$(".content").mCustomScrollbar("scrollTo",$(this).attr("href"));
			});

		});
	})(jQuery);
</script>
</head>
<body>
<!--header-->
<header>
 <h1><img src="{% static 'admin/images/admin_logo.png' %}"/></h1>
 <ul class="rt_nav">
  <li><a href="{% url 'Admin:admin_index' %}" target="_blank" class="website_icon">站点首页</a></li>
  <li><a href="{% url 'Admin:admin.logout' %}" class="quit_icon">安全退出</a></li>
 </ul>
</header>
<!--aside nav-->
<!--aside nav-->
<aside class="lt_aside_nav content mCustomScrollbar">
 <h2><a href="#">超级管理员：&nbsp;{{ userinfo.username }}</a></h2>
 <ul>
   <li>
   <dl>
    <!--当前链接则添加class:active-->
    <dt>图片管理</dt>
    <dd><a href="{% url 'Admin:imagemanage' %}"  >图片上传</a></dd>
   </dl>
  </li>
  <li>
   <dl>
    <!--当前链接则添加class:active-->
    <dt>商品管理</dt>
    <dd><a href="{% url 'Admin:addproduct' %}">商品添加/修改</a></dd>
    <dd><a href="{% url 'Admin:categorym' %}">种类添加</a></dd>
    <dd><a href="{% url 'Admin:product_list' %}" class="active1">商品列表</a></dd>
   </dl>
  </li>
  <li>
   <dl>
    <dt>订单管理</dt>
    <dd><a href="#" >订单列表</a></dd>
    <dd><a href="#">订单详情</a></dd>
   </dl>
  </li>

  <li>
   <p class="btm_infor">© YeQin 版权所有</p>
  </li>
 </ul>
</aside>

<section class="rt_wrap content mCustomScrollbar">
 <div class="rt_content">
      <div class="page_title">
       <h2 class="fl">商品列表示例</h2>
       <a href="{% url 'Admin:addproduct' %}" class="fr top_rt_btn add_icon">添加商品</a>
      </div>
      <section class="mtb">
       <select class="select">
        <option>商品分类</option>

       </select>
       <input type="text" class="textbox textbox_225" placeholder="输入产品关键词或产品货号..."/>
       <input type="button" value="查询" class="group_btn"/>
      </section>
      <table class="table">
       <tr>
        <th>商品图片</th>
        <th>商品名称</th>
        <th>商品种类</th>
        <th>商品介绍</th>
        <th>价格</th>
        <th>折扣</th>
        <th>操作</th>
       </tr>
       {% for product in products %}
       <tr>
         {% with imgl=product.pdImage%}
              <td class="center"><img id="img" src="{{ imgl}}" width="50" height="50"/></td>
        {% endwith %}

        <td class="center">{{ product.pdname }}</td>
        <td class="center">{{ product.category_id }}</td>
         <td class="center">{{ product.pdInfo }}</td>
       <td class="center"><strong class="rmb_icon">{{ product.pdprice }}</strong></td>
        <td class="center">{{ product.discount }} 折</td>
        <td class="center">
         <a href="{% url 'Admin:modproduct' %}?p_id={{ product.pid }}" title="修改商品" class="link_icon">&#101;</a>
         <a href="{% url 'Admin:prodelete' %}?p_id={{ product.pid }}" title="删除商品" class="link_icon">&#100;</a>
        </td>
       </tr>
       {% empty %}
       {% endfor %}
      </table>
      <aside class="paging">
          {% if page.has_previous  %}
              <a href="{% url 'Admin:product_list' %}?page_num={{ page.previous_page_number }}">上一页</a>
              {% else %}
              <a href="#">上一页</a>
          {% endif %}

          {% if page.has_next  %}
              <a href="{% url 'Admin:product_list' %}?page_num={{ page.next_page_number }}">下一页</a>
              {% else %}
              <a href="#">下一页</a>
          {% endif %}
      </aside>
 </div>
</section>
<script src="{% static '/js/product_list.js' %}" type="text/javascript"></script>
</body>
</html>
